package com.workplan.client.modules.defineworkweek;

import net.customware.gwt.presenter.client.EventBus;
import net.customware.gwt.presenter.client.widget.WidgetPresenter;

import com.workplan.client.widgets.addshifts.AddShifts;
import com.workplan.client.widgets.addshifts.AddShiftsPresenter;
import com.workplan.client.widgets.addshifts.AddShiftsPresenterImpl;
import com.workplan.client.widgets.workdays.Workdays;
import com.workplan.client.widgets.workdays.WorkdaysPresenter;
import com.workplan.client.widgets.workdays.WorkdaysPresenterImpl;

public class DefineWorkweekPresenterImpl extends
		WidgetPresenter<DefineWorkweekPresenter.Display> implements
		DefineWorkweekPresenter {

	private final WorkdaysPresenter.Display workdays = new Workdays();
	private final WorkdaysPresenter workdaysPresenter;

	private final AddShiftsPresenter.Display addShifts = new AddShifts();
	private final AddShiftsPresenter addShiftsPresenter;

	public DefineWorkweekPresenterImpl(Display display, EventBus eventBus) {
		super(display, eventBus);
		workdaysPresenter = new WorkdaysPresenterImpl(workdays, eventBus);
		addShiftsPresenter = new AddShiftsPresenterImpl(addShifts, eventBus);
	}

	@Override
	protected void onBind() {
		workdaysPresenter.bind();
		display.setWorkdays(workdaysPresenter.getDisplay());

		addShiftsPresenter.bind();
		display.setAddShifts(addShiftsPresenter.getDisplay());

		display.init();
	}

	@Override
	protected void onUnbind() {
		workdaysPresenter.unbind();
		addShiftsPresenter.unbind();
	}

	@Override
	protected void onRevealDisplay() {
	}

}
